﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Door : MonoBehaviour
{
    Animator anim;
    BoxCollider2D coll;
    void Start()
    {
        anim = GetComponent<Animator>();
        coll = GetComponent<BoxCollider2D>();

        GameManager.instance.Isdoor(this);

        coll.enabled = false;

    }

    public void OpenDoor()//gamemanager进行调用的函数
    {
        anim.Play("Door open");
        coll.enabled = true;
    }
    public void OnTriggerEnter2D(Collider2D collision)
    {
        if(collision.CompareTag ("Player"))//去到下一个房间
        {
            Debug.Log("触发进入下一关");
            GameManager.instance.NextLevel();

        }
    }


}
